/**
 * @namla
 */
function send_question(yahoo){
	var con_quest=$("#con_quest").val();
	var count =Number($("#count").val());
	if(con_quest==0 || con_quest==''){
		alert('Nội dung không hợp lệ');
		return false;
	}
	$.ajax({
		url: "/index/question-ajax",
		type: "POST",
		data: "content="+con_quest+"&yahoo="+yahoo+"&count="+count,
		success: function(data){
			if(count == 0) {
				$(".list_question").append(data);
				$("#count").val((count+1));
			}
			if(count>0 && count <4) {
				$("#"+count).after(data);
				$("#count").val((count+1));
			}
			if (count>=4){
				$("#"+count).remove();
				$("#"+(count-1)).after(data);
			}
		},
		error: function(){
			alert("Error loadding from sever");
		}
		
	})
}
function del_question(id,key){
	$.ajax({
		url: "/index/del-ques",
		type: "POST",
		data: "id="+id,
		success: function(data){
			$("#"+key).remove();
			$("#count").val($("#count").val()-1);
		},
		error: function(){
			alert("Error loadding from sever");
		}
	})
}
function displayThanhToan(div_id, check){
   $.ajax({
		url: "/index/pay-popup",
		type: "POST",
		data: {'check': check },
		success: function(data){
		      $('#'+div_id).html(data);
		},
		error: function(){
			alert("Error loadding from sever");
		}
		
	});
}

function showWidget(id){
    $.ajax({
        url: "/index/widget-add",
        success: function(data){
            $("#"+id).text(data);
        },
        complete: function(){
            $("#"+id).css('display', 'block');
        },
        error: function(){
            alert("Error loadding from server");
        }
    });
    
}